﻿using Frameworks;
using Network.General.Client;
using Network.Utils;

public class UserManager : Singleton<UserManager>
{
    private UserManager() { }

    public RoomData Room { set; get; }

    public override void OnSingletonInit()
    {
        base.OnSingletonInit();
    }

    public override void Dispose()
    {
        base.Dispose();
    }

    public string IP { get => IPUtils.SelfIP; }

    private int _port = 0;
    public int Port
    {
        get
        {
            if (_port == 0)
            {
                System.Random random = new System.Random();
                do
                {
                    _port = random.Next(5000, 65536);
                } while (IPUtils.PortIsUsed().Contains(_port));
            }
            return _port;
        }
    }
}